package com.briup.recognition.web.controller;

import com.briup.recognition.bean.BaseLog;
import com.briup.recognition.bean.BaseLogExample;
import com.briup.recognition.service.IBaseLogService;
import com.briup.recognition.utils.Message;
import com.briup.recognition.utils.MessageUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/baselog")
public class BaseLogController {

    @Resource
    private IBaseLogService baseLogService;

    @GetMapping("query")
    public Message query(){
        List<BaseLog> list = baseLogService.query();

        return MessageUtil.success(list);
    }

    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(BaseLog baseLog){
        baseLogService.saveOrUpdate(baseLog);
        return MessageUtil.success("更新成功");
    }

    @PostMapping
    public  Message deleteById(Long id){
        baseLogService.deleteById(id);

        return  MessageUtil.success("删除成功");

    }
}
